<?php 
namespace Models;
/**
 * 快递价格模型
 * @package Models
 * @author 江羿平<hugcolin@163.com>
 */
class Delivery extends Model{

	protected $_table = 'deliverys';

	protected $_filter = FALSE;

	protected $_primekey = 'id';

	/**
	 * 根据地区ID获取配送价格
	 */
	public function get_price($region_id){
		
		$delivery = $this->where('region_id',$region_id)->get_one();
		if($delivery){
			return $delivery;
		}
		$region = new Region;
		$region = $region->find($region_id);
		return $this->get_price($region['parent_id']);
	}
}
?>